//
//  UIImage+scallImage.m
//  ZLFastDoctor
//
//  Created by 李岚清 on 16/5/27.
//  Copyright © 2016年 LS. All rights reserved.
//

#import "UIImage+scallImage.h"
#define NQPicW 80

@implementation UIImage (scallImage)

+ (UIImage *)getScallImage:(UIImage *)image{
    //1.获取上下文
    UIGraphicsBeginImageContext(CGSizeMake(NQPicW, NQPicW));
    //2.绘制
    [image drawInRect:CGRectMake(0, 0, NQPicW, NQPicW)];
    //3.获得图片
    UIImage *img = UIGraphicsGetImageFromCurrentImageContext();
    //4.结束上下文
    UIGraphicsEndImageContext();
    return img;
}

+ (UIImage *)getScallImage:(UIImage *)image scale:(CGSize)scale{
    //1.获取上下文
    UIGraphicsBeginImageContext(scale);
    //2.绘制
    [image drawInRect:CGRectMake(0, 0, scale.width, scale.height)];
    //3.获得图片
    UIImage *img = UIGraphicsGetImageFromCurrentImageContext();
    //4.结束上下文
    UIGraphicsEndImageContext();
    return img;
}

@end
